<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        div {
            position: relative;
            float: left;
            margin: 300px 50px;
            box-sizing: border-box;
            width: 316px;
            height: 170px;
           
        }

        img {
            width: 100%;
            height: 100%;
           
            vertical-align: middle;

        }

        /* 正确的 */

        /* div:hover::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            border: 10px solid rgba(0, 255, 0, .5);
            box-sizing: border-box;
        } */

        /* 错误 */

         div:hover {
            /* content: '';

            position: absolute;

            top: 0;
            left: 0;

            width: 100%;
            height: 100%; */

             border: 10px solid rgba(0, 255, 0, .5);
            

             

        } 

        
    </style>
</head>

<body>
    <div>
        <img src="images/3.jpg" alt="">
    </div>
    <div>
        <img src="images/2.jpg" alt="">
    </div>
    <div>
        <img src="images/1.jpg" alt="">
    </div>

</body>

</html>